/* --------------------------- INCLUDES ------------------------------------- */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
//#include <math.h>

/* --------------------------- DEFINES -------------------------------------- */

#define TRUE	1
#define FALSE !TRUE

#define ERROR_OK 0
#define ERROR_GRAL -1
#define ERROR_PARAM -2
#define ERROR_MEM -3

#define TRANSPOSE 4
#define DETRANSPOSE 5
#define NMIN 1
#define NMAX 10
#define ANS_FILENAME "decyphered-text.txt"
#define round(x) ((x)>=0)?(int)((x)+0.5):(int)((x)-0.5)

/* --------------------------- DATA STRUCTS --------------------------------- */

typedef struct {
	int ques;
	int des;
	int es;
	int total;
} statisticsT;


/* --------------------------- PROTOTYPES ----------------------------------- */

void decryptTransposition(char * message, char * rta);
static char * removeEnies(char * text);
static char * addEnies(char * text);
//void visit(int k, char ** matrix, FILE * fp, int cols, int rows);
void visit(int k, char ** matrix, int cols, int rows, char * rta);
static char ** createMatrix(char * text, int cols, int offset);
static void transposeMatrix(char ** matrix, char * key, int cols, int rows);
static char * matrixToText(char ** matrix, int cols, int rows);
int searchQuInMatrix(char ** matrix, int cols, int rows);
void printMatrix(char ** matrix, int cols, int rows);